<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>参数默认值</title>
  <script>
    /**
     * 1. 参数默认值
     * 处理方法一：借鉴Jquery底层源码思想
     */
    function fun1(a,b){
      b = b || 0
      return a + b
    }
    // let s = fun1(1,2)
    // console.log("s = ",s)
    /**
     * 2. 参数默认值
     * 处理方法二：借助es6的默认值参数处理
     */
    function fun2(a,b=0){
      return a + b
    }
    let s = fun2(1,5)
    console.log("s = ",s)
  </script>
</head>
<body>

</body>
</html>
